package com.study.talk.module.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ApplyJoinGroupRecord对象", description = "")
public class ApplyJoinGroupRecord implements Serializable {
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty("id")
    private Integer id;

    @ApiModelProperty("申请加入的群聊id")
    private Integer groupId;

    @ApiModelProperty("申请用户id")
    private Integer applyUserId;

    @ApiModelProperty("群聊群主id")
    private Integer groupMainUserId;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;


    public ApplyJoinGroupRecord(GroupInfo groupInfo,Integer applyUserId){
        this.applyUserId =applyUserId;
        this.groupId = groupInfo.getId();
        this.groupMainUserId = groupInfo.getMainUser();
    }
}
